<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <!-- import CSS -->
    <link rel="stylesheet" href="https://cdn.staticfile.org/element-ui/2.15.9/theme-chalk/index.css">
</head>
<body>
<div id="app">
    <el-menu mode="horizontal" :ffdefault-active="activeIndex" @select="handleSelect">
        <el-menu-item v-for="arrEmp in arr"
                      :index="arrEmp.id"
                     >
            {{arrEmp.name}}
        </el-menu-item>
    </el-menu>
</div>
</body>
<!-- import Vue before Element -->
<script src="https://cdn.staticfile.org/vue/2.6.14/vue.min.js"></script>
<!-- import JavaScript -->
<script src="https://cdn.staticfile.org/element-ui/2.15.9/index.min.js"></script>
<script>
    let v = new Vue({
        el: '#app',
        data: function () {
            return{
                activeIndex: '1',
                arr:[
                    {id:1,name:"精品男装"},
                    {id:2,name:"时尚女装"},
                    {id:3,name:"数码科技"},
                    {id:4,name:"医药健康"},
                ]

            }
        },
        methods: {
            handleSelect(key, keyPath) {
                v.$message("您点击的分类id为："+key)
            }
        }
    })
</script>
</html>